<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text">
<input type="button" value="帅哥" onclick="f(1)">
<input type="button" value="美女" onclick="f(2)">
<hr>
<script>
    function f(x) {
        let i1 = document.querySelector("input");
        let num = i1.value;
        while (num >= 0) {
            let i = document.createElement("img");
            let url = x == 1 ? "2.webp" : "../b.png";
            i.src = url;
            document.body.append(i);
            num--;
        }
        }

</script>
</body>
</html>